#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import logging


def get_logger(name, level=logging.DEBUG):
    logger = logging.getLogger(name)
    logger.setLevel(level)

    # 日志处理器
    log_handler = logging.StreamHandler()

    # 设置日记格式
    formatter = logging.Formatter('%(asctime)s %(levelname)s [in %(pathname)s:%(lineno)d]: %(message)s')

    log_handler.setFormatter(formatter)

    logger.addHandler(log_handler)

    return logger
